package com.cskaoyan.shopping.api;

import com.cskaoyan.mall.commons.result.ServiceCallResponse;
import com.cskaoyan.mall.commons.result.ServiceCallResponseUtil;
import com.cskaoyan.mall.dto.ClearCartItemRequest;
import com.cskaoyan.shopping.service.ICartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @since 2022/08/25 20:32
 * @author sunxuJ
 */
@RestController
public class OrderApi {

    @Autowired
    ICartService cartService;

    @DeleteMapping("/rpc/cart/items")
    public ServiceCallResponse clearLocalCart(@RequestBody ClearCartItemRequest clearCartItemRequest){
        cartService.clearCartItemByUserID(clearCartItemRequest);
        return new ServiceCallResponseUtil<>().ok(null);
    }
}
